package 力扣_简单题;

/**
 * @author 连安利
 * @version 1.0
 * @date 2021/3/26 16:14
 */
public class 删除排序链表中的重复元素 {
    public ListNode deleteDuplicates(ListNode head) {
        if(head ==null ){
            return null;
        }
        ListNode cur = head;
        while(cur.next != null){
            if(cur.val == cur.next.val){
                cur.next = cur.next.next;
            }
            else{
                cur = cur.next;
            }

        }
        return head;
    }
}
